<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="format-detection" content="telephone=no,email=no,adress=no">
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.js"></script>
<script type="text/javascript">

$(function(){

	$('#merNo').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/merchant_auto.html',
    	minChars:1,
    	paramName:'merNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.merNo, data: dataItem.merName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});

	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}
	});
	
});

</script>
</head>
<body >
<div id="dataSearch" >    
<form id="sform" action="venture_listblackcard.html" method="get" enctype="multipart/form-data">
<table style="width: 100%;">
<tr>
<td height="25" >
	<b>操作说明:查询项可以用逗号分隔</b> 
</td>
</tr>
<tr><td height="30" >
<s:textfield  id="merNo" name="merNo" placeholder="商户编号"></s:textfield>
<s:textfield  id="bckCard" name="bckCard" placeholder="卡号"></s:textfield>
<s:textfield  id="bckDateTop"  name="bckDateTop" placeholder="日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="bckDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="bckDateEnd"  name="bckDateEnd" placeholder="日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="bckDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
<input type="button" class="submit" value="查询搜索" onclick="sform.submit();"/>
</td>
</tr>
<tr><td><hr/></td></tr>
<tr>
<td height="30" >
		<input type="hidden"  id="keys" name="keys"  value=""/>
		<input type="button" class="submit" value="批量上传" onclick="location.href='<%=request.getContextPath()%>/venture_editblackcard.html'"/>
		<input type="button" class="submit"   value="导出数据"  onclick="if(confirm('确认要执行导出操作吗?')){window.open(location.href.replace('list','export'));}"/>
		<input type="button" class="submit" value="删除选定" onclick="location.href='<%=request.getContextPath()%>/venture_moveblackcard.html?bckNos='+$('#keys').val()"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="商编排序" onclick="toSort('sortField','merNo')"/>
		<input type="button" class="submit" value="日期排序" onclick="toSort('sortField','bckDate')"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')"/>
		<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')"/>
</td>
</tr>
</table>
</form>
</div>

<table id="dataTable" style="width: 100%;" class="easyui-datagrid" >
<thead>
<tr>
<th data-options="field:'ck'" checkbox="true"></th>
<th data-options="field:'merNo', width:'10%',align:'left' , halign: 'left'">商户编号</th>
<th data-options="field:'bckCard', width:'20%',align:'left' , halign: 'left'">内容</th>
<th data-options="field:'bckRemark', width:'55%',align:'left' , halign: 'left'">备注</th>
<th data-options="field:'bckDate', width:'100',align:'left' , halign: 'left'">日期</th>

</tr>
</thead>
<tbody>
<s:iterator value="blackcardList" id="show" status="seq">
<tr>
<td><s:property value="#show.bckNo"/></td>
<td><s:property value="#show.merNo"/></td>
<td><s:property value="#show.bckCard"/></td>
<td><s:property value="#show.bckRemark"/></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.bckDate"/></s:text>

</tr>
</s:iterator>
</tbody>
</table>
<br/>
<br/>
<br/>
</body>
</html>
